Skip to content

feat: support list blob scans#7664

Open
Xuanwo wants to merge 6 commits into
mainfrom
xuanwo/list-blob-scan
Open

feat: support list blob scans#7664
Xuanwo wants to merge 6 commits into
mainfrom
xuanwo/list-blob-scan

Conversation

@Xuanwo

@Xuanwo Xuanwo commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

This adds scan-based support for List<Blob> and nested blob leaves such as Struct<List<Blob>>.

Descriptor scans preserve the original Arrow nesting and expose blob leaves as descriptors without loading payload bytes. BlobHandling::AllBinary materializes only blob leaves to binary values while keeping the surrounding List / Struct layout intact.

This keeps the existing one-blob-per-row APIs unchanged and avoids adding a public random-access API for list blob values.

Summary by CodeRabbit

  • New Features
    • Added Blob V2 binary view support for list and nested fields, with correct scan/filtered read/take output schema behavior.
    • Improved Blob V2 payload resolution for inline, dedicated, packed, and external sources.
  • Bug Fixes
    • Stricter Blob V2 detection and more consistent conversion/unload behavior.
    • Improved projection and schema intersection handling for Blob V2, including nested cases and better type-ignore behavior.
    • Preserved nulls, list offsets, and descriptor validity; ensured the binary-view marker is handled consistently.
  • Tests
    • Expanded Blob V2 coverage for binary/view materialization, descriptor projection, and nested list/struct scenarios.

@github-actions github-actions Bot added A-encoding Encoding, IO, file reader/writer enhancement New feature or request labels Jul 7, 2026
@Xuanwo Xuanwo marked this pull request as ready for review July 7, 2026 10:15
@codecov

codecov Bot commented Jul 7, 2026

Copy link
Copy Markdown

# Conflicts:
#	rust/lance-core/src/datatypes/schema.rs
@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 9142a0b7-ac7c-4e75-afb3-79c434f30fef

📥 Commits

Reviewing files that changed from the base of the PR and between 1ca127d and e554285.

📒 Files selected for processing (2)
  • rust/lance-core/src/datatypes/field.rs
  • rust/lance/src/dataset/blob.rs

📝 Walkthrough

Walkthrough

Blob V2 handling validates descriptors more strictly, supports binary views for nested list fields, preserves descriptor nulls, and materializes binary payloads during filtered, unfiltered, and take execution paths.

Changes

Blob V2 binary flow

Layer / File(s) Summary
Blob field handling and projection policy
rust/lance-core/src/datatypes/field.rs, rust/lance-core/src/datatypes/schema.rs
Blob V2 identity checks, binary conversion, projection and intersection handling, binary-loading policies, and unload-transition tests are updated.
Descriptor nulls and list preprocessing
rust/lance-encoding/src/encodings/logical/blob.rs, rust/lance/src/dataset/blob.rs
Descriptor validity mirrors source struct nulls, while list and large-list blob fields are recursively normalized and preprocessed.
Blob V2 descriptor traversal and materialization
rust/lance/src/dataset/blob.rs
Nested descriptor traversal is validated, payload locations are resolved through a read context, and descriptor arrays and lists are materialized into binary payload arrays.
Scan, filtered read, and take integration
rust/lance/src/io/exec/filtered_read.rs, rust/lance/src/io/exec/scan.rs, rust/lance/src/io/exec/take.rs
Execution paths use descriptor schemas and row addresses when needed, materialize binary batches, and expose public binary output schemas.

Estimated code review effort: 5 (Critical) | ~120 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ScanPlanner
  participant FragmentReader
  participant BlobV2ReadContext
  participant BlobMaterializer
  ScanPlanner->>FragmentReader: select descriptor schema and row addresses
  FragmentReader->>BlobMaterializer: provide decoded descriptor batch
  BlobMaterializer->>BlobV2ReadContext: resolve descriptor payload locations
  BlobV2ReadContext->>BlobMaterializer: return payload bytes
  BlobMaterializer->>ScanPlanner: return public binary batch
Loading

Possibly related issues

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding scan support for list-shaped blob fields.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch xuanwo/list-blob-scan

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@rust/lance-core/src/datatypes/field.rs`:
- Around line 603-611: In the relevant field conversion logic, replace the bare
unwrap on LogicalType::try_from(&DataType::LargeBinary) with expect containing a
clear reason, and replace the duplicated "packed" and "lance-encoding:packed"
metadata removals with iteration over the existing PACKED_KEYS constant used by
is_packed_struct.

In `@rust/lance/src/dataset/blob.rs`:
- Around line 2338-2361: Update the blob-v2 filtered-read materialization around
materialize_blob_v2_binary_array and FilteredReadExec schema handling so
requested system columns (_rowid, _row_last_updated_at_version, and
_row_created_at_version) are preserved alongside _rowaddr. Ensure
projection.to_bare_schema() does not drop them, and that the produced columns
and output schema match FilteredReadExec::schema() for every requested system
column.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 02fd15aa-ede3-45ce-859c-38adabfb62c3

📥 Commits

Reviewing files that changed from the base of the PR and between 1946a5a and 3c08f7e.

📒 Files selected for processing (6)
  • rust/lance-core/src/datatypes/field.rs
  • rust/lance-core/src/datatypes/schema.rs
  • rust/lance-encoding/src/encodings/logical/blob.rs
  • rust/lance/src/dataset/blob.rs
  • rust/lance/src/io/exec/filtered_read.rs
  • rust/lance/src/io/exec/scan.rs

Comment thread rust/lance-core/src/datatypes/field.rs Outdated
Comment thread rust/lance/src/dataset/blob.rs Outdated

@BubbleCal BubbleCal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blob payload reads are serialized across list elements.

Comment thread rust/lance/src/dataset/blob.rs Outdated
Comment on lines +2518 to +2538
for (idx, row_addr) in row_addrs.iter().copied().enumerate() {
if descriptions.is_null(idx) || columns.kinds.is_null(idx) {
builder.append_null();
continue;
}

match kind {
let kind = BlobKind::try_from(columns.kinds.value(idx))?;
if matches!(kind, BlobKind::Inline)
&& columns.positions.value(idx) == 0
&& columns.sizes.value(idx) == 0
{
builder.append_value([]);
continue;
}

let entry = read_context
.collect_entry(&columns, idx, idx, row_addr)
.await?;
if let Some(entry) = entry {
let data = entry.file.read().await?;
builder.append_value(data.as_ref());

@BubbleCal BubbleCal Jul 10, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blob payloads are awaited one at a time here, so a list with N remote blobs needs roughly N sequential round trips and BlobSource cannot coalesce the reads. Filtered scans also pay this cost before applying the residual filter.

field.children = field
.children
.into_iter()
.map(|child| self.unload_if_needed(child))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filtering a blob field can still panic on this path. BlobsDescriptions replaces a blob v2 leaf with descriptor children whose IDs are all -1; the subsequent union/projection drops those children, so applying the projection selects the parent with no children and hits the assertion in Field::apply_projection. For example, blobs IS NOT NULL on the new List<Blob> path, or image.image_bytes IS NOT NULL, raises pyo3_runtime.PanicException. The filtered-read test only filters id, so this case is not covered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-encoding Encoding, IO, file reader/writer enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants